import {
  observable,
  extendObservable,
  computed,
  toJS,
  action
} from '../../libs/mobx.js';

var CurStore = function () {
  let me = this;
  let getDefault = function () {
    return {
      titleValue:'',
      descValue:'',
      coverPath:'',
      descObj:{}
    }
  }
  extendObservable(this, getDefault());

  this.reset = action(() => {
    Object.assign(this, getDefault());
  })

  this.setTitle = action(function (v) {
    this.titleValue = v;
  });

  this.setdesc = action(function (v) {
    this.descValue = v;
  })

  this.setCover = action(function (filePath) {
    this.coverPath = filePath;
  })

  this.initDescObj = action(function (obj) {
    this.descObj = obj;
  })

  this.updateDesc = action(function (obj) {
    this.descObj[obj.key] = obj.value;
  })
  
}

export default new CurStore();